export function jsAMap(ak) {
	window._AMapSecurityConfig = {
		securityJsCode: '5ebaf32cfab761b9c23255bd9984b352',
	}
    return new Promise(function (resolve, reject) {
        const script = document.createElement("script");
        script.type = "text/javascript";
        script.src = `https://webapi.amap.com/maps?v=1.4.15&key=${ak}&callback=init`;
        // script.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=init`
        script.charset = 'utf-8';
        script.onerror = reject;
        document.head.appendChild(script);
        window.init = function () {
            // resolve(BMapGL)
            resolve(AMap)
        }
    })
}
